﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Threading;

namespace Spider.DataFactory
{
    public class NameFactory : IFactory
    {

        List<string> source = new List<string>();

        public NameFactory()
        {
            DataTable dt = SQLHelper.ExecuteDataset("select name from name").Tables[0];
            foreach (DataRow row in dt.Rows)
            {
                source.Add(row["name"].ToString());
            }
        }

        #region IFactory Members

        public string GetDate()
        {
            Thread.Sleep(10);
            Random radom = new Random();
            int i = radom.Next(0, source.Count - 1);
            return source[i].ToString();
        }

        #endregion
    }

    public class ContentFactory : IFactory
    {

        List<string> source = new List<string>();

        public ContentFactory()
        {
            Thread.Sleep(15);
            DataTable dt = SQLHelper.ExecuteDataset("select Content from Content").Tables[0];
            foreach (DataRow row in dt.Rows)
            {
                source.Add(row["Content"].ToString());
            }
        }

        #region IFactory Members

        public string GetDate()
        {
            Thread.Sleep(10);
            Random radom = new Random();
            int i = radom.Next(0, source.Count - 1);
            return source[i].ToString();
        }

        #endregion
    }

    public class WidthFactory : IFactory
    {

        int[] source = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79 };

        public WidthFactory()
        {
        }

        #region IFactory Members

        public string GetDate()
        {
            Thread.Sleep(10);
            Random radom = new Random();
            int i = radom.Next(0, source.Length - 1);
            return source[i].ToString();
        }

        #endregion
    }

    public class HeightFactory : IFactory
    {

        int[] source = { 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171 };


        #region IFactory Members

        public string GetDate()
        {
            Thread.Sleep(10);
            Random radom = new Random();
            int i = radom.Next(0, source.Length - 1);
            return source[i].ToString();
        }

        #endregion
    }

    public class AgeFactory : IFactory
    {

        int[] source = { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 };

        public AgeFactory()
        {

        }

        #region IFactory Members

        public string GetDate()
        {
            Thread.Sleep(10);
            Random radom = new Random();
            int i = radom.Next(0, source.Length - 1);
            return source[i].ToString();
        }

        #endregion
    }

    public class FaceFactory : IFactory
    {

        List<string> source = new List<string>();

        public FaceFactory()
        {
            DataTable dt = SQLHelper.ExecuteDataset("select face from face").Tables[0];
            foreach (DataRow row in dt.Rows)
            {
                source.Add(row["face"].ToString());
            }
        }

        #region IFactory Members

        public string GetDate()
        {
            var str = source[source.Count - 1];

            source.RemoveAt(source.Count - 1);

            return str;

            //Thread.Sleep(20);
            //Random radom = new Random();
            //int i = radom.Next(0, source.Count - 1);
            //return source[i].ToString();
        }

        #endregion
    }

    public class JobFactory : IFactory
    {
        string[] source = { "企管", "客服", "主妇", "医疗", "艺术", "自由", "文化", "媒体", "餐饮", "娱乐", "服务", "职员" };

        public JobFactory()
        {

        }

        #region IFactory Members

        public string GetDate()
        {
            Thread.Sleep(10);
            Random radom = new Random();
            int i = radom.Next(0, source.Length - 1);
            return source[i].ToString();
        }

        #endregion
    }

    public class EducationFactory : IFactory
    {

        string[] source = { "中专", "大专", "本科", "硕士" };

        public EducationFactory()
        {

        }

        #region IFactory Members

        public string GetDate()
        {
            Thread.Sleep(10);
            Random radom = new Random();
            int i = radom.Next(0, source.Length - 1);
            return source[i].ToString();
        }

        #endregion
    }

    public class QQFactory : IFactory
    {

        // string[] source = { "278668053", "71836798", "20505892", "549850136", "1596492585" };
        List<string> source = new List<string>();

        public QQFactory()
        {
            DataTable dt = SQLHelper.ExecuteDataset("select qq from qq").Tables[0];
            foreach (DataRow row in dt.Rows)
            {
                source.Add(row["qq"].ToString());
            }
        }

        #region IFactory Members

        public string GetDate()
        {
            var str = source[source.Count - 1];

            source.RemoveAt(source.Count - 1);

            return str;

            //Thread.Sleep(20);
            //Random radom = new Random();
            //int i = radom.Next(0, source.Count - 1);
            //return source[i].ToString();
        }

        #endregion

        //public QQFactory()
        //{

        //}

        //#region IFactory Members

        //public string GetDate()
        //{
        //    Thread.Sleep(10);
        //    Random radom = new Random();
        //    int i = radom.Next(0, source.Length - 1);
        //    return source[i].ToString();
        //}

        //#endregion
    }



    public class CityFactory : IFactory
    {
        List<string> source = new List<string>();

        public CityFactory()
        {
            DataTable dt = SQLHelper.ExecuteDataset("select * from qq").Tables[0];
            foreach (DataRow row in dt.Rows)
            {
                source.Add(row["city"].ToString());
            }
        }

        #region IFactory Members

        public string GetDate()
        {
            var str = source[source.Count - 1];

            source.RemoveAt(source.Count - 1);

            return str;
        }

        #endregion

    }

    //public class CityFactory : IFactory
    //{

    //    string[] source = { "北京", "上海", "天津", "重庆", "沈阳", "南京", "武汉", "苏州", "杭州", "宁波", "温州", "济南", "青岛", "烟台", "郑州", "深圳", "广州", "东莞", "珠海", "中山", "佛山", "成都", "昆明", "西安" };

    //    public CityFactory()
    //    {

    //    }

    //    #region IFactory Members

    //    public string GetDate()
    //    {
    //        Thread.Sleep(10);
    //        Random radom = new Random();
    //        int i = radom.Next(0, source.Length - 1);
    //        return source[i].ToString();
    //    }

    //    #endregion
    //}

    public class StanceFactory : IFactory
    {

        string[] source = { "先见一面相互认识再做决定", "找个知己，不干涉生活", "偶尔无聊，找玩伴 ", "找男/女朋友，也能发展成结婚对象", "保密" };

        public StanceFactory()
        {

        }

        #region IFactory Members

        public string GetDate()
        {
            Thread.Sleep(10);
            Random radom = new Random();
            int i = radom.Next(0, source.Length - 1);
            return source[i].ToString();
        }

        #endregion
    }
}
